<template lang="pug">
  el-dialog(
    :title="title"
    :visible="visibleDialog"
    append-to-body
    center
    destroy-on-close
    v-el-drag-dialog
    @close="$_handleCancel"
  )
    slot
    slot(name="footer")
      p.tr(v-if="footer")
        el-button(size="small" @click="$_handleCancel") 返回
        el-button(size="small" type="primary" @click="sureHandle") 确定
</template>
<script>
import elDragDialog from '@/directive/el-drag-dialog'

export default {
  directives: { elDragDialog },
  props: {
    title: {
      type: String,
      default: '弹窗'
    },
    value: {
      type: Boolean,
      default: false
    },
    footer: {
      type: Boolean,
      default: true
    }
  },
  methods: {
    sureHandle () {
      this.$emit('sureHandle')
      $_handleCancel()
    },
    $_handleCancel () {
      this.visibleDialog = false
      this.$emit('cancel')
    }
  }
}
</script>
